#include <SLCD.h>


#include <AFSoftSerial.h>

AFSoftSerial mySerial =  AFSoftSerial(3, 2);

void setup()  {
  pinMode(13, OUTPUT);
  Serial.begin(9600);
  Serial.println("Goodnight moon!");
  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
  backlightOn();
  selectLineOne();
  mySerial.println("Hello, world?");
}

void loop()                     // run over and over again
{
  if (mySerial.available()) {
      selectLineOne();
      mySerial.print("test");

  }
}

void selectLineOne(){  //puts the cursor at line 0 char 0.
   mySerial.print(0xFE, BYTE);   //command flag
   mySerial.print(128, BYTE);    //position
}
void selectLineTwo(){  //puts the cursor at line 0 char 0.
   mySerial.print(0xFE, BYTE);   //command flag
   mySerial.print(192, BYTE);    //position
}
void clearLCD(){
   mySerial.print(0xFE, BYTE);   //command flag
   mySerial.print(0x01, BYTE);   //clear command.
}
void backlightOn(){  //turns on the backlight
    mySerial.print(0x7C, BYTE);   //command flag for backlight stuff
    mySerial.print(157, BYTE);    //light level.
}
void backlightOff(){  //turns off the backlight
    mySerial.print(0x7C, BYTE);   //command flag for backlight stuff
    mySerial.print(128, BYTE);     //light level for off.
}
void serCommand(){   //a general function to call the command flag for issuing all other commands   
  mySerial.print(0xFE, BYTE);
}
